package com.google.code.sysarch.v4.vrml_loader;

public class VRML_Version1 implements VRML_Definitions {

	private final static String[][] blocks = {{
		"_default",
			"{",				"begin",
			"}",				"return",
			"[",				"begin",
			"]",				"return",
			"DEF",				"Definition",
	},{			
		"_root",
			"Separator",		"Separator",		
	},{
		"_unknown",
	},{
		"Coordinate3",
			"point",			"GEOM_POINT_LIST",
	},{
		"IndexedFaceSet",
			"coordIndex",		"GEOM_POINT_INDEX_LIST",
	},{
		"Material",
			"diffuseColor",		"float[3]",
			"specularColor",	"float[3]",
			"shininess",		"float",
			"transparency",		"float",
	},{
		"MatrixTransform",
			"matrix",			"MATRIX_TRANSFORM",
	},{
		"PerspectiveCamera",
			"focalDistance",	"float",
	},{
		"Separator",
			"Material",			"Material",
			"Separator",		"Separator",
			"Coordinate3",		"Coordinate3",
			"IndexedFaceSet",	"IndexedFaceSet",
			"MatrixTransform",	"MatrixTransform",
			"PerspectiveCamera","PerspectiveCamera",
	}};

	
	public VRML_Version1() {
		
	}

	public boolean expected(String attribute, String block) {
		for (int i=0; i<blocks.length; i++) {
			if (blocks[i][0].equals(block) || blocks[i][0].equals("_default")) {
				for (int j=1; j<blocks[i].length; j+=2) {
					if (blocks[i][j].equals(attribute)) {
						return true;
					}
				}
				if (blocks[i][0].equals(block)) return false;
			}
		}
		return false;
	}

	public String type(String attribute, String block) {
		for (int i=0; i<blocks.length; i++) {
			if (blocks[i][0].equals(block) || blocks[i][0].equals("_default")) {
				for (int j=1; j<blocks[i].length; j+=2) {
					if (blocks[i][j].equals(attribute)) {
						return blocks[i][j+1];
					}
				}
				if (blocks[i][0].equals(block)) return null;
			}
		}		
		return null;
	}

	public String[] getDefault(String attribute, String blocktype) {
		return null;
	}
	
}
